<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../common/admin.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>main</title>
<link href="../css/style.css" rel="stylesheet" type="text/css"/>
<style>body {background-color: #eaece1;}</style>
</head>

<body>
<div class="main">
  <div class="main-title">栏目设置</div>
  <div class="main-content">
  <%if request.QueryString("add")<>"" then%>
<%elseif request.QueryString("edit")<>"" then
	
		  set rsm=server.CreateObject("adodb.recordset")
		  sql="select * from Hot where id="&request.QueryString("edit")&""
		  rsm.open sql,conn,1,3
		  if not rsm.eof then
	%>
    <table width="100%" border="0" cellspacing="1" cellpadding="3" class="tab">
  <tr>
    <td colspan="6">
    <form name="form" method="post" action="">
    <input name="title" type="text" class="input" id="title" value="<%=rsm("title")%>" maxlength="50" />
    <input name="jp_title" type="text" class="input" id="jp_title" value="<%=rsm("jp_title")%>" maxlength="200" />
    <input name="sort" type="text" class="input" id="sort" value="<%=rsm("sort")%>" style="width:50px" maxlength="10" />
    <input name="fid" type="hidden" id="fid" value="<%=rsm("fid")%>" />
    图标<input name="pic" type="text" class="input" id="pic" value="<%=rsm("pic")%>" /><input type="button" name="Submit26" value="图片上传 " onClick="window.open('../inc/upload.asp?formname=form&editname=pic&amp;uppath=baby_sphoto&amp;filelx=jpg&amp;type=pic','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')" />
    <input type="submit" name="button" id="button" value="保存" />
    <a href="javascript:;" onClick="javascript:history.back(-1);">返回</a>
    </form>
    </td>
    </tr>
    </table>
    <%
		  rsm.close
		  set rsm=nothing
		  end if
    else
	%>
  <table width="100%" border="0" cellspacing="1" cellpadding="3" class="tab">
  <tr>
    <td colspan="6">
    <form name="form" method="post" action="">
    <input name="title" type="text" class="input" id="title" value="栏目名称" maxlength="50" />
    <input name="jp_title" type="text" class="input" id="jp_title" value="日文搜索关键字" maxlength="200" />
    <input name="sort" type="text" class="input" id="sort" value="序号" style="width:50px" maxlength="10" />
    图标<input name="pic" type="text" class="input" id="pic" value="" /><input type="button" name="Submit26" value="图片上传 " onClick="window.open('../inc/upload.asp?formname=form&editname=pic&amp;uppath=baby_sphoto&amp;filelx=jpg&amp;type=pic','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')" />
    <input type="submit" name="button" id="button" value="添加" />
    </form>
    </td>
    </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>名称</strong></td>
    <td align="right" bgcolor="#FFFFFF"><strong>操作</strong></td>
    <td align="center" bgcolor="#FFFFFF"><strong>删除</strong></td>
    <td align="center" bgcolor="#FFFFFF"><strong>状态</strong></td>
    <td align="center" bgcolor="#FFFFFF"><strong>序号</strong></td>
    <td bgcolor="#FFFFFF"><strong>日文搜索关键字</strong></td>
    </tr>
    <%
					  set rsm=server.CreateObject("adodb.recordset")
					  sql="select * from Hot where fid=0 order by sort"
					  rsm.open sql,conn,1,3
					  if not rsm.eof then
					  do while not rsm.eof
					  %>
  <tr>
    <td bgcolor="#FFFFFF"><%=rsm("title")%></td>
    <td align="right" bgcolor="#FFFFFF"><a href="?edit=<%=rsm("id")%>">编辑</a></td>
    <td align="center" bgcolor="#FFFFFF"><a href="?del=<%=rsm("id")%>">删除</a></td>
    <td align="center" bgcolor="#FFFFFF"><%if rsm("mark")=true then response.Write "<a href='?mark="&rsm("id")&"&type=0'>正常</a>" else response.Write "<a href='?mark="&rsm("id")&"&type=1'><font color='red'>关闭</font></a>"%></td>
    <td align="center" bgcolor="#FFFFFF"><%=rsm("sort")%></td>
    <td bgcolor="#FFFFFF"><%=rsm("jp_title")%></td>
    </tr>
   
    <%
					  rsm.movenext
					  loop
					  rsm.close
					  set rsm=nothing
					  end if		 
					  %>
  </table>
  <%end if%>
</div>
</div>
</body>
</html>
<%
if request.Form("button")="添加" then

	title=request.Form("title")
	sort=cstr(request.Form("sort"))
	jp_title=request.Form("jp_title")
	fid=request.Form("fid")
	pic=request.Form("pic")
	
	if isnumeric(sort)=false then sort=0
	if fid="" then fid=0

	set rsm=server.createobject("adodb.recordset")
	sql="select * from Hot"
	rsm.open sql,conn,1,3
	rsm.addnew
	rsm("title")=title
	rsm("sort")=sort
	rsm("jp_title")=jp_title
	rsm("fid")=fid
	rsm("pic")=pic
	rsm.update
	response.write"<script language=JavaScript>{window.alert('添加成功！');window.location.href='type.asp';}</script>"
	rsm.close
	set rsm=nothing

elseif request.Form("button")="保存" then

	title=request.Form("title")
	sort=cstr(request.Form("sort"))
	jp_title=request.Form("jp_title")
	fid=request.Form("fid")
	id=request.QueryString("edit")
	pic=request.Form("pic")
	
	if isnumeric(sort)=false then sort=0
	if fid="" then fid=0

	set rsm=server.createobject("adodb.recordset")
	sql="select * from Hot where id="&id&""
	rsm.open sql,conn,1,3
	rsm("title")=title
	rsm("sort")=sort
	rsm("jp_title")=jp_title
	rsm("fid")=fid
	rsm("pic")=pic
	rsm.update
	response.write"<script language=JavaScript>{window.alert('保存成功！');window.location.href='type.asp';}</script>"
	rsm.close
	set rsm=nothing

elseif request.QueryString("del")<>"" then

	conn.execute("delete from Hot where fid="&request.QueryString("del")&"")
	conn.execute("delete from Hot where id="&request.QueryString("del")&"")
	response.Redirect "type.asp"
	
elseif request.QueryString("type")="0" then

	conn.execute("update Hot set mark=0 where id="&request.QueryString("mark")&"")
	response.Redirect "type.asp"
	
elseif request.QueryString("type")="1" then

	conn.execute("update Hot set mark=1 where id="&request.QueryString("mark")&"")
	response.Redirect "type.asp"

end if
%>